package com.cqd.rp_goods.web;


import com.cqd.rp_goods.dto.ResultEntity;
import com.cqd.rp_goods.dto.UseDto;
import com.cqd.rp_goods.entity.DbUse;
import com.cqd.rp_goods.service.IDbUseService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mht
 * @since 2020-03-16
 */
@RestController
@CrossOrigin
@RequestMapping("/dbUse")
public class DbUseController {

    @Autowired
    IDbUseService useService;

    @RequestMapping("selectUseList")
    public ResultEntity selectUseList(UseDto useDto){
        PageHelper.startPage(useDto.getPageNum(),useDto.getPageSize());
        List<DbUse> dbUses = useService.selectUseList(useDto);
        PageInfo<DbUse> info = new PageInfo<>(dbUses);
        return ResultEntity.ok(info);
    }
}
